import { defineStore } from 'pinia'
const useMenuStore = defineStore('menu', {
  state: () => {
    return {
      dialogVisible: false,
      isMouseLock: true,
      screenType: 'auto',
      isStream: false,
      mousePercent: 20,
      micPercent: 80
    }
  },
  actions: {
    setState(params) {
      for (let key in params) {
        this[key] = params[key]
      }
    }
  },
  // persist: true // 默认本地localstorage
  persist: {
    key: 'gameMenu',
    storage: sessionStorage, // localStorage
    paths: ['isMouseLock', 'screenType'] // 空数组是都不存储，null或undefined时为存储所有，填写值时存储当前值
  }
})

export default useMenuStore
